import {OnInit, Component} from "@angular/core";
import {selector} from "rxjs/operator/publish";
import {Http} from "@angular/http";
import {UserService} from "../service/user.service";
import {FrontUser} from "../entity/User";
import {Router} from "@angular/router";
import {CommonIp} from "../entity/Ip";
@Component({
  selector :'user-ranking',
  templateUrl:'./user-ranking.html',
})
export class UserRankingComponent extends CommonIp implements  OnInit{
  public rankinguser:Array<FrontUser>;
  constructor(public userservice:UserService,public router:Router){
    super();
  }
  ngOnInit(): void {
    this.getUserRanking();
  }
  public getUserRanking(){
    this.userservice.getRanking().then(rankinguser=>this.rankinguser=rankinguser);
  }
  public showPersion(userid:string,img:string){
    sessionStorage.setItem("rankingid",userid);
    sessionStorage.setItem("isclick","true");
    sessionStorage.setItem("rankingimg",this.userimgIp+img);
    sessionStorage.setItem("personInfoId",userid);
    this.router.navigate(['/personal/personalFollow/',{id:sessionStorage.getItem("personInfoId"), pageNo: 0}]);
  }
}
